﻿<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <title>企业活动</title>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="/ViewV5/CSS/icfont_qj/iconfont.css">
    <link rel="stylesheet" type="text/css" href="/ViewV5/CSS/bootstrap3.3.5/css/bootstrap.css">
    <link rel="stylesheet" type="text/css" href="/ViewV5/CSS/animate.css">
    <link rel="stylesheet" type="text/css" href="/ViewV5/CSS/index.css">
    <link rel="stylesheet" type="text/css" href="/ViewV5/CSS/default.css">
    <link href="/ViewV5/AppPage/XXFB/WX.css" rel="stylesheet" />
    <style>
    </style>
</head>

<body style="background-color: #F8F8F8; height: 100%;" ms-controller="XXFBVIEW">
    <div class="padding20">
        <div class="card card3 mb20">
            <div class="detail-nav">
                <div class="tab-kh nav-bt">
                    <span class="cur"><i class="iconfont icon-bookmark"></i>新闻公告信息</span>
                </div>
            </div>
            <div style="position:absolute;width:430px;right:0; color:red; text-align:center" ms-if="isVisible==0">
                此新闻公告不存在或已删除
            </div>
            <div class="detail-con" ms-if="isVisible==1">
                <div class="detail-item">
                    <span class="item-tit">{{ComFunJS.convertuser(XXFBData.CRUser)}}</span>
                    <div class="item-con"> </div>
                </div>
                <div class="detail-item">
                    <span class="item-tit">发送给 </span>
                    <div class="item-con"> {{ComFunJS.convertuser(XXFBData.JSUser)}}</div>
                </div>
                <div class="detail-item">
                    <span class="item-tit">时间</span>
                    <span class="item-con">{{XXFBData.FBTime}}</span>
                </div>

            </div>
            <div class="video_unit" style="margin:20px;">
                <div class="js_list">
                    <!-- 当选中的时候，添加class：active和delete，其中active用来显示蓝色边框delete用来显示删除按钮；ps：当video_artical数量大于两个的时候，video_artical选中的时候才出现关闭按钮 -->
                    <a class="js_article video_image" ms-repeat-el="XXFBDataList" ms-visible="$index==0" target="_blank" ms-attr-href="'/ViewV5/AppPage/XXFB/XXFBChildrenVIEW.html?ID='+el.ID">
                        <div class="choose_mode_style"></div>
                        <div class="video_image_wrap" ms-visible="el.ImageIds!=''">
                            <img  ms-attr-src="{{ComFunJS.getfile(el.ImageIds)}}">
                        </div>
                        <p class="image_edit_placeholder" ms-visible="el.ImageIds==''">
                            <span class="placeholder_text">封面图片<br>推荐尺寸:900像素*500像素</span>
                            <span class="placeholder_vertical"></span>
                        </p>
                        <p class="js_article_title video_sub_title" style="margin-bottom:0px">{{el.XXTitle}}</p>
                    </a>
                    <a class="js_article video_artical" href="javascript:;" ms-repeat-el="XXFBDataList" target="_blank" ms-visible="$index>0" ms-attr-href="'/ViewV5/AppPage/XXFB/XXFBChildrenVIEW.html?ID='+el.ID">
                        <div class="choose_mode_style"></div>
                        <img class="video_artical_img" ms-visible="el.ImageIds!=''"  ms-attr-src="{{ComFunJS.getfile(el.ImageIds)}}">
                        <p class="image_edit_placeholder" ms-visible="el.ImageIds==''"></p>
                        <p class="js_article_title video_artical_title" style="margin-top: 30px; font-size: 18px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; height: 40px; width: 75%;">{{el.XXTitle}}</p>
                        <span class="video_vertical"></span>
                    </a>
                </div>
            </div>
            <div ms-if="Type=='history'">
                <input type="button" class="btn" value="保存为素材" ms-click="UpdateSCUser()" ms-if="XXFBData.SCUser==''||$.inArray(curUser,XXFBData.SCUser.split(','))<0" style="margin-left:20px;" />
                <span ms-if="XXFBData.SCUser!=''&&$.inArray(curUser,XXFBData.SCUser.split(','))>-1" style="margin-left:20px; font-size:14px; color:#ff6a00">已保存为素材</span>
                <input type="button" class="btn" value="撤回" ms-click="DeleteXXFB()" style="margin-left:20px;" ms-if="curUser==XXFBData.CRUser" />
            </div>
        </div>
    </div>

    <script src="/ViewV5/JS/jquery-1.11.2.min.js"></script>
    <script src="/ViewV5/JS/layer/layer.js"></script>
    <script src="/ViewV5/CSS/bootstrap3.3.5/js/bootstrap.js"></script>
    <script src="/ViewV5/JS/avalon1.47.js"></script>
    <script src="/ViewV5/JS/SZHLCommon.js?jsver=20160915"></script>
    <script type="text/javascript">
        var model = avalon.define({
            $id: "XXFBVIEW",
            XXFBDataList: [],
            curUser: ComFunJS.getnowuser(),
            XXFBData: {},
            isVisible: 1,
            Type: ComFunJS.getQueryString("Type"),
            GetXXItemList: function () {
                $.getJSON('/API/VIEWAPI.ashx?Action=XXFB_GETXXFBITEMLIST', { P1: ComFunJS.getQueryString("ID") }, function (resultData) {
                    if (resultData.ErrorMsg == "") {
                        if (resultData.Result1) {
                            model.XXFBDataList = resultData.Result;
                            model.XXFBData = resultData.Result1;
                            if (model.XXFBDataList.size() == 1) { 
                                location.href = "/ViewV5/AppPage/XXFB/XXFBChildrenVIEW.html?ID=" + model.XXFBDataList[0].ID;
                            }
                        } else {
                            model.isVisible = 0;
                        }

                    }
                })
            }, UpdateSCUser: function () {
                var twmodel = { "Type": 0, "Content": "" };
                twmodel.Content = JSON.stringify(model.XXFBDataList.$model);
                $.post("/API/VIEWAPI.ashx?ACTION=XXFB_SETSCUSER", { P1: ComFunJS.getQueryString("ID"), P2: JSON.stringify(twmodel) }, function (jsonresult) {
                    if ($.trim(jsonresult.ErrorMsg) == "") {
                        top.ComFunJS.winsuccess("操作成功");
                        model.XXFBData.SCUser = jsonresult.Result.SCUser;
                    }
                });
            }, DeleteXXFB: function () {
                top.ComFunJS.winconfirm("确定撤回，此新闻公告将撤回到草稿箱，确定要撤回吗？", function () {
                    $.post("/API/VIEWAPI.ashx?ACTION=XXFB_DELETEXXFB", { P1: model.XXFBData.ID }, function (jsonresult) {
                        if ($.trim(jsonresult.ErrorMsg) == "") {
                            top.ComFunJS.winsuccess("撤回成功");
                        }
                    });
                })
            }
        });
        avalon.ready(function () {
            model.GetXXItemList();
        })
    </script>

</body>

</html>
